<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://eureka.yigolden.net/stringutils/sutaglib/1.0" prefix="su"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>竞价</title>
<script type="text/javascript" src="${staticResources}/js/ajax.js"></script>
<script type="text/javascript">
function refreshcaptcha() {
	var timenow = new Date().getTime();    
	var captcha = document.getElementById("imgverifycode").src = "${contextPath}/captcha?flag=stac&random="+timenow;
}

function doBid() {
	var baid = document.getElementById("baid").value;
	var price = document.getElementById("price").value;
	var verifycode = document.getElementById("verifycode").value;
	var mode="ajax";
	
	var params="baid=" + encodeURIComponent(baid);
	params+="&price="+encodeURIComponent(price);
	params+="&verifycode="+encodeURIComponent(verifycode);
	params+="&mode="+encodeURIComponent(mode);

	doAjax("Bid"
			,params,function(rst){
		var rst=eval('(' +rst+ ')');
		if(rst.status == 0) {
			window.alert("竞价成功！");
			parent.location.reload();
		} else  {
			window.alert(rst.message);
		}
	});
}
</script>

</head>
<body>

<h3>竞价</h3>

<p>最低竞价：${auction.biddingPrice}</p>

<form method="post" action="" onsubmit="doBid();return false;">
  <input type="hidden" name="baid" id="baid" value="${auction.baID}" />
  <p>请输入价格：<input type="text" name="price" id="price" /></p>
  <p>验证码：<input type="text" name="verifycode" id="verifycode" style="width:60px; height:20px;"/><img id="imgverifycode" src="${contextPath}/captcha?flag=abid" width="80" height="30"><a href="#" onclick = "refreshcaptcha();return false;">换一张</a></p>
  <input type="submit" value="提交" />
</form>

</body>
</html>